<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>generator function yield</title>
  <script>
    window.onload = () => {
      function * show () {
        console.log('a')
        yield
        console.log('b')
        return 5
      }

      let obj = show()
      const res1 = obj.next()   // { value: 12, done: false }
      console.log(res1)
      const res2 = obj.next()   // { value: 5, done: true }
      console.log(res2)
    }
  </script>
</head>
<body>
  
</body>
</html>